import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';

@Injectable()
export class AppService {
  constructor(private configService: ConfigService) {
    console.log(this.configService.get('database.host'));
  }
  getDatabaseConfig() {
    return {
      host: this.configService.get<string>('database.host'),
      port: this.configService.get<number>('database.port'),
      user: this.configService.get<string>('database.user'),
      pass: this.configService.get<string>('database.pass'),
    };
  }

  getPort(): number {
    return this.configService.get<number>('port') ?? 3000;
  }
  getHello(): string {
    return 'Hello World!';
  }
}
